Val | With |
Syntax:
@While variable [Not] {=/>/</<=/>=} variable
...commands...
@Wend
The While command allows conditional looping within @commands. The @commands between the While and the Wend are executed as long as the comparison is TRUE. While commands can be nested up to 10 levels deep.
The comparator can be:
= equal to, <> not equal to, > greater than, < less than,
<= less than or equal to, >= greater than or equal to.
The variable parameters used can be attributes, strings and arrays. The types must be compatible for the comparison to function properly. i.e. the comparisons must BOTH be in ONE of these three groups.
·List attribute, string literal, string variable, or string array.
·Numeric attribute, numeric literal, numeric variable or numeric array.
·Date attribute or date literal.
Several comparisons can be logically grouped using combinations of OR and AND by enclosing each comparison within brackets ( ). For instance:
@While (Num <> 0) and (Count < 100)
and similarly:
@While (Num <> 0) and ((Count < 100) or (Count > 1000))
Examples:
@ASSIGN NumAtt = 1
@WHILE NumAtt <= 5
@ASSIGN str[NumAtt] = '<EMPTY>'
@ASSIGN NumAtt = NumAtt + 1
@WEND
The above example initialises the first 5 String Array variables to '<EMPTY>'. Note that the @commands which are executed by the While command are indented. This is optional and has been done to make the structure more readable. You can use space indentation like this before any @command word, providing the @ marker always remains as the FIRST character.
Several lines can be used for the While statement itself. The point where you split the line is quite flexible. For example:
@WHILE (Grade = 'Director') OR ((Grade = 'SenMgr') AND
(Salary < 20000)) OR (Dept = 'Sales')
OR (Date = '24/12/90')
...do commands...
@WEND
@For/Next, @While/Wend and @Repeat/Until - there is a maximum of 10 nested loops for each of these commands (a combination of these commands can provide up to 30 nested loops).